package com.sl.au.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.sl.au.entity.Account;
import com.sl.au.entity.ChanceKeyMan;
import com.sl.au.entity.Chance;
import com.sl.au.repository.AccountRepository;
import com.sl.au.repository.ChanceKeyManRepository;
import com.sl.au.service.ChanceKeyManService;

@Service("ChanceKeyManService")
@Transactional
public class ChanceKeyManServiceImpl extends BaseServiceImpl implements ChanceKeyManService{

	@Autowired
	ChanceKeyManRepository chanceKeyManRepository;
	
	 public ChanceKeyManRepository getRepository() {
			return this.chanceKeyManRepository;
		}
	@Override
	public List<ChanceKeyMan> getChanceKeyMans(int start, int length, String chanceId, String orderName, String dir) {
		Page<ChanceKeyMan> pages = null;
		Pageable pageable=new PageRequest(start/length,length, Sort.Direction.DESC,"createTime");
		pages = chanceKeyManRepository.findChanceKeyMan(chanceId, pageable);
		return pages.getContent();
	}
	 
}
